package com.hmdp.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedissonConfig {
    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();
        //多节点模式
//        config.useClusterServers().addNodeAddress("redis://192.168.30.130:7000", "redis://192.168.30.130:7001", "redis://192.168.30.130:7002", "redis://192.168.30.130:7003", "redis://192.168.30.130:7004", "redis://192.168.30.130:7005");
        config.useSingleServer().setPassword("ningzaichun").setAddress("redis://192.168.30.130:6379"); //单节点设置模式
        return Redisson.create(config);
    }
}
